//package net.xmmpp.uc.im.bootstrap.web.config;
//
//import com.alibaba.csp.sentinel.init.InitFunc;
//import com.alibaba.csp.sentinel.slots.block.RuleConstant;
//import com.alibaba.csp.sentinel.slots.block.degrade.DegradeRule;
//import com.alibaba.csp.sentinel.slots.block.degrade.DegradeRuleManager;
//import com.alibaba.csp.sentinel.slots.block.flow.FlowRule;
//import com.alibaba.csp.sentinel.slots.block.flow.FlowRuleManager;
//
//import java.util.ArrayList;
//import java.util.List;
//
//public class FlowRuleInitFunc implements InitFunc {
//
//    @Override
//    public void init() throws Exception {
////        List<FlowRule> rules = new ArrayList<>();
////        FlowRule rule = new FlowRule();
////        rule.setCount(1);
////        rule.setResource("hello");
////        rule.setGrade(RuleConstant.FLOW_GRADE_QPS);
////        rule.setLimitApp("default");
////
////        rules.add(rule);
////        FlowRuleManager.loadRules(rules);
//
//        List<DegradeRule> degradeRules = new ArrayList<>();
//        DegradeRule degradeRule = new DegradeRule("/dash")
//                .setGrade(RuleConstant.DEGRADE_GRADE_RT)
//                .setCount(500)
//                .setMinRequestAmount(1)
////                .setRtSlowRequestAmount(1)
////                .setStatIntervalMs(30000) // 30s
//                .setTimeWindow(10);
//
//        degradeRules.add(degradeRule);
//        DegradeRuleManager.loadRules(degradeRules);
//    }
//}
